package com.rgs.base.core.page;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * @author Ren Gaoshuai
 * @ClassName IPageRequestModel
 * @Description 统一的分页请求模型接口
 * @create 2022-01-18 9:22
 **/
@ToString
@ApiModel(description = "通用的分页查询")
@NoArgsConstructor
@AllArgsConstructor
@Data
public class PageRequestModel implements IPageRequestModel {
    @ApiModelProperty(value = "单页行数", example = "50", required = true)
    @Min(1)
    protected Integer perPage;
    @ApiModelProperty(value = "当前页数", example = "1", required = true)
    @Min(1)
    protected Integer page;
    @ApiModelProperty(value = "排序字段", example = "xxx", required = false)
    @NotBlank(message = "不能为空")
    protected String orderBy;

//    @Override
//    public void setOrderBy(String orderBy) {
//        this.orderBy = CaseFormatStaticClass.CAMEL_TO_UNDERSCORE.convert(orderBy);
//    }
}
